<?php
/* @var $this ProductBrandController */
/* @var $model ProductBrand */

$this->breadcrumbs=array(
        'Product Manage'=>array('/admin/product/admin'),
	'Product Brands'
);

$this->menu=array(
        array('label'=>Yii::t('main', 'Product Admin'), 'url'=>array('/admin/product/admin')),		
);
?>

<table>
    <tr>
        <td>
            <?php $this->widget('zii.widgets.grid.CGridView', array(
                    'id'=>'product-brand-grid',
                    'afterAjaxUpdate'=>'afterReload',
                    'dataProvider'=>$model->search(),
                    'filter'=>$model,
                    'columns'=>array(
                            array(
                                'header'=>'',
                                'value'=>'$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)'
                            ),
                            'name',
                            array(
                                'name'=>'createTime',
                                'value'=>'date("Y-m-d H:i:s", $data->createTime)',
                                'filter'=>false
                            ),
                            array(
                                    'class'=>'CButtonColumn',
                                    'template'=>'{update} {delete}',
                                    'buttons'=>array(
                                        'delete'=>array(
                                            
                                        )
                                    )
                            ),
                    ),
            )); ?>
        </td>
        <td style="width:10px; vertical-align: top">
            <?php $this->renderPartial('_form', array('model'=>new ProductBrand)) ?>
        </td>
    </tr>
</table>

<script type="text/javascript">
    $(function(){
        $('.update').click(function(e){            
            e.preventDefault();
            var url=$(this).attr('href');
            var pos=url.lastIndexOf('/');
            var id=url.substring(pos+1);
            
            //call function in _form.php file
            beginUpdate(id);
            
            return false;
        });
    });
    
    function reloadGrid(){
        $.fn.yiiGridView.update('product-brand-grid');
    }
    
    function afterReload(id, data){
        $('.update').click(function(e){            
            e.preventDefault();
            var url=$(this).attr('href');
            var pos=url.lastIndexOf('/');
            var id=url.substring(pos+1);
            
            //call function in _form.php file
            beginUpdate(id);
            
            return false;
        });
    }
</script>
